<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"></c:set>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>重置密码</title>
<link rel="stylesheet" href="${ctx}/statics/css/bootstrap.min.css" />
<link rel="stylesheet" href="${ctx}/statics/css/font-awesome.min.css" />
<link rel="stylesheet"
	href="${ctx}/statics/js/layer/skin/default/layer.css" />
<link rel="stylesheet"
	href="${ctx}/statics/js/bootstrap-table/bootstrap-table.css" />
<link rel="stylesheet" href="${ctx}/statics/js/toastr/toastr.css" />
</head>
<body>
	<div id="main-content">
		<div class="row">
			<div class="col-md-12">
				<div class="panel panel-default">
					<div class="panel-heading">重置密码</div>
					<!-- /.panel-heading -->
					<div class="panel-body">
						<div class="row">
							<div class="col-xs-12">
								<!-- PAGE CONTENT BEGINS -->
								<form class="form-horizontal" role="form" id="entity_form">
									<div class="form-group">
										<label class="control-label col-sm-3">旧的密码：</label>
										<div class="col-sm-6">
											<input type="text" class="form-control col-sm-3"
												name="userPw">
										</div>
									</div>
									<div class="form-group">
										<label class="control-label col-sm-3">新密码：</label>
										<div class="col-sm-6">
											<input type="text" class="form-control col-sm-3"
												name="newUserPw">
										</div>
									</div>
									<div class="form-group">
										<div align="center">
											<button class=" btn btn-sm btn-info" onclick="savePw()">确定
											</button>
											<span><c:if test="${messages!=null}">
													<p style="color: red">${messages}</p>
												</c:if></span>
										</div>
									</div>
								</form>
							</div>
						</div>
					</div>
					<!-- panel body -->
				</div>
			</div>
		</div>
	</div>
	<%@ include file="../common.jsp"%>
	<script type="text/javascript"
		src="${ctx}/statics/js/jquery-form/jquery.form.js"></script>
</body>
<script type="text/javascript">
	function savePw() {
		var flag = checkForm();
		if (!flag) {
			return;
		}
		$("#entity_form").attr("action", "${ctx}/user/savePw.do");
		$("#entity_form").submit();
	}
	function checkForm() {
		var userPw = $("input[name=userPw]").val();
		if (userPw == '' || userPw == null) {
			alert("密码不能为空");
			return false;
		}
		var newUserPw = $("input[name=newUserPw]").val();
		if (newUserPw == '' || newUserPw == null) {
			alert("密码不能为空");
			return false;
		}
		return true;
	}
</script>
</html>